// components/VInput/VInput.js
Component({
  relations: {
    '../VForm/VFormItem/VFormItem': {
      type: 'parent',
      linked(target) {
        if (target) {
          this._formItemInstance = target;
        }
        // console.log('link parent', target);
      }
    }
  },
  options: {
    pureDataPattern: /^_/
  },
  properties: {
    value: {
      type: String,
      default: ''
    }
  },
  data: {
    _formItemInstance: null
  },

  /**
   * 组件的方法列表
   */
  methods: {
    onInput(event) {
      const { value } = event.detail;
      this.triggerEvent('change', value);
      this._formItemInstance?.validate(value);
    },
    _getAllLi: function(){
      var nodes = this.getRelationNodes('../VForm/VFormItem/VFormItem');
      // console.log('allItems', nodes);
    }
  },
  ready() {
    this._getAllLi()
  }
})
